package com.zhuzi;

import com.ibm.mq.jms.MQConnectionFactory;
import com.ibm.mq.spring.boot.MQConfigurationProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jms.JmsProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.jms.annotation.EnableJms;
import org.springframework.jms.connection.CachingConnectionFactory;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.jms.ConnectionFactory;

@EnableConfigurationProperties({MQConfigurationProperties.class, JmsProperties.class})
@EnableJms
@SpringBootApplication
public class App {
    @Resource
    CachingConnectionFactory connectionFactory;


    @PostConstruct
    public void init() {
        System.out.println("sessionsize" + connectionFactory.getSessionCacheSize());

        ConnectionFactory factory = connectionFactory.getTargetConnectionFactory();
        MQConnectionFactory mqConnectionFactory = (MQConnectionFactory) factory;
        System.out.println("ccsid" + mqConnectionFactory.getCCSID());

    }
    public static void main(String[] args) {
        SpringApplication.run(App.class, args);
        //MQConfigurationListenerDefault
    }

}
